/* this script calculates how many tracks will fit
* on your tape recording, e.g.
*
* tape 45
*
* will do the job for C-90 tapes.
*
*/
/* (c) copyright 1992,93 by F.J. Reichert */
zerotime = "00:00:00"
maxtime = "99:59:99"
parse arg tapetime test
options failat 11;
trks = numtrks();
options failat 10;
options results;
if tapetime = '?' | tapetime = '' then do
say 'usage: tape <time> [test]';
exit(0);
end;
if trks = 0 then do;
say 'no tracks found';
exit(5);
end;
do i = 1 to trks;
toc i;
parse value result with tracktime ' ';
cmptime tapetime tracktime;
if result = 1 then do;
say 'track #'||i 'will not fit on any take';
exit 5;
end;
end;
lost = zerotime;
leaving = tapetime;
remaining = tapetime;
takes = 1;
firsttrack = 1;
i = 1;
do forever;
if i > trks then do;
remaining = zerotime;
end;
else do;
toc i;
parse value result with tracktime ' ';
remaining = leaving;
subtime remaining tracktime;
remaining = result;
end;
if remaining = zerotime then do;
lasttrack = i - 1;
say "0a"x||'Take #'||overlay(takes,' ',1,2) 'from start of track #'||overlay(firsttrack,' ',1,2) 'to end of track #'||overlay(lasttrack,' ',1,2,) 'leaving' leaving
addtime lost leaving;
lost = result;
if test = "" then call record_tape(firsttrack,lasttrack);
firsttrack = i;
takes = takes + 1;
leaving = tapetime;
if i > trks then leave;
end;
else do;
leaving = remaining;
i = i + 1;
end;
end;
say '--- recording complete! ---' lost 'unused on tape';
exit(0);
record_tape: procedure
parse arg first,last .;
pause;
say '--- start tape and press [F6], [ESC] to skip take';
wait fkey 6;
if rc >= 5 then do;
say '--- take skipped';
return 0;
end;
options results;
toc first;
parse value result with '(' starttime ':'
toc last;
parse value result with '-' endtime ')'
set track first;
play;
say '--- recording started';
do i = first to last;
toc i;
parse value result with abstime ' ' '"' name '"';
say "09"x||'track #'||overlay(i,' ',1,2) '('||abstime||')' name;
end;
subtime left(endtime,2) starttime;
say '--- no user interaction needed for' left(result,2) 'minutes!';
/* some frames less, or we might never reach it */
subtime endtime "00:00:10";
say result;
wait time result;
pause;
return 0;
end;
/* Tell us how many tracks there are on this disc */